package com.common.basis.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础父类
 * @author wangguochao
 * @ignore
 */
@Data
public class BaseEntity implements Serializable {

    @TableId(type = IdType.ASSIGN_UUID)
    protected String id;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    protected String createBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    protected LocalDateTime created;

    /**
     * 修改人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    protected String lastModifiedBy;
    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    protected LocalDateTime updated;

    /**
     * 删除字段
     */
    @JsonIgnore
    @TableLogic
    private int isDel;

}